import React from 'react'
import PropTypes from 'prop-types'
import './index.less'

export default class Star extends React.Component {
    render () {
        let classname = this.props.active ? 'star active' : 'star',
            {onClick, disabled} = this.props
        return (
            <i
                className={classname}
                onClick={disabled?null:()=>onClick(this.props.index)}
            >
            ★
            </i>
        )
    }
}

Star.propsTypes = {
    active : PropTypes.bool,
    onClick : PropTypes.func,
    index : PropTypes.number,
    disabled: PropTypes.bool
}